home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / Make / source / variable.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-20  |  4.6 KB  |  110 lines

  1. /* Definitions for using variables in GNU Make.
  2. Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
  3. This file is part of GNU Make.
  4.  
  5. GNU Make is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9.  
  10. GNU Make is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with GNU Make; see the file COPYING.  If not, write to
  17. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. /* Codes in a variable definition saying where the definition came from.
  20.    Increasing numeric values signify less-overridable definitions.  */
  21. enum variable_origin
  22.   {
  23.     o_default,        /* Variable from the default set.  */
  24.     o_env,        /* Variable from environment.  */
  25.     o_file,        /* Variable given in a makefile.  */
  26.     o_env_override,    /* Variable from environment, if -e.  */
  27.     o_command,        /* Variable given by user.  */
  28.     o_override,     /* Variable from an `override' directive.  */
  29.     o_automatic,    /* Automatic variable -- cannot be set.  */
  30.     o_invalid        /* Core dump time.  */
  31.   };
  32.  
  33. /* Structure that represents one variable definition.
  34.    Each bucket of the hash table is a chain of these,
  35.    chained through `next'.  */
  36.  
  37. struct variable
  38.   {
  39.     struct variable *next;    /* Link in the chain.  */
  40.     char *name;            /* Variable name.  */
  41.     char *value;        /* Variable value.  */
  42.     enum variable_origin
  43.       origin ENUM_BITFIELD (3);    /* Variable origin.  */
  44.     unsigned int recursive:1;    /* Gets recursively re-evaluated.  */
  45.     unsigned int expanding:1;    /* Nonzero if currently being expanded.  */
  46.     enum
  47.       {
  48.     v_export,        /* Export this variable.  */
  49.     v_noexport,        /* Don't export this variable.  */
  50.     v_ifset,        /* Export it if it has a non-default value.  */
  51.     v_default        /* Decide in target_environment.  */
  52.       } export ENUM_BITFIELD (2);
  53.   };
  54.  
  55. /* Structure that represents a variable set.  */
  56.  
  57. struct variable_set
  58.   {
  59.     struct variable **table;    /* Hash table of variables.  */
  60.     unsigned int buckets;    /* Number of hash buckets in `table'.  */
  61.   };
  62.  
  63. /* Structure that represents a list of variable sets.  */
  64.  
  65. struct variable_set_list
  66.   {
  67.     struct variable_set_list *next;    /* Link in the chain.  */
  68.     struct variable_set *set;        /* Variable set.  */
  69.   };
  70.  
  71. extern struct variable_set_list *current_variable_set_list;
  72.  
  73. /* expand.c */
  74. extern char *variable_buffer_output PARAMS ((char *ptr, char *string, unsigned int length));
  75. extern char *variable_expand PARAMS ((char *line));
  76. extern char *variable_expand_for_file PARAMS ((char *line, struct file *file));
  77. extern char *allocated_variable_expand_for_file PARAMS ((char *line, struct file *file));
  78. #define    allocated_variable_expand(line) \
  79.   allocated_variable_expand_for_file (line, (struct file *) 0)
  80. extern char *expand_argument PARAMS ((char *str, char *end));
  81.  
  82. /* function.c */
  83. extern int handle_function PARAMS ((char **op, char **stringp));
  84. extern int pattern_matches PARAMS ((char *pattern, char *percent, char *word));
  85. extern char *subst_expand PARAMS ((char *o, char *text, char *subst, char *replace,
  86.         unsigned int slen, unsigned int rlen, int by_word, int suffix_only));
  87. extern char *patsubst_expand PARAMS ((char *o, char *text, char *pattern, char *replace,
  88.         char *pattern_percent, char *replace_percent));
  89.  
  90. /* expand.c */
  91. extern char *recursively_expand PARAMS ((struct variable *v));
  92.  
  93. /* variable.c */
  94. extern void push_new_variable_scope PARAMS ((void));
  95. extern void pop_variable_scope PARAMS ((void));
  96. extern void define_automatic_variables PARAMS ((void));
  97. extern void initialize_file_variables PARAMS ((struct file *file));
  98. extern void print_file_variables PARAMS ((struct file *file));
  99. extern void merge_variable_set_lists PARAMS ((struct variable_set_list **setlist0, struct variable_set_list *setlist1));
  100. extern struct variable *try_variable_definition PARAMS ((char *filename, unsigned int lineno, char *line, enum variable_origin origin));
  101.  
  102. extern struct variable *lookup_variable PARAMS ((char *name, unsigned int length));
  103. extern struct variable *define_variable PARAMS ((char *name, unsigned int length, char *value,
  104.         enum variable_origin origin, int recursive));
  105. extern struct variable *define_variable_for_file PARAMS ((char *name, unsigned int length,
  106.         char *value, enum variable_origin origin, int recursive, struct file *file));
  107. extern char **target_environment PARAMS ((struct file *file));
  108.  
  109. extern int export_all_variables;
  110.